package cn.doyo.spring.test.common;

import cn.doyo.spring.test.bean.UserService3;
import cn.duyo.spring.beans.BeansException;
import cn.duyo.spring.beans.factory.config.BeanPostProcessor;

/**
 * @author du
 */
public class MyBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if ("userService3".equals(beanName)) {
            UserService3 userService3 = (UserService3) bean;
            userService3.setLocation("变更为：重庆");
        }
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }

}
